home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / scenarios / train / Train 06.scl < prev    next >
Encoding:
Text File  |  2005-11-28  |  7.5 KB  |  261 lines

  1. scenario = GetProperties()
  2. scenario.ScenarioType = 1
  3. scenario.Title = "sc_Train_06_00"
  4. scenario.Map = "Beotorum.dat"
  5. scenario.Description = "sc_Train_06_01"
  6. scenario.Picture = "Train 06.dds"
  7. scenario.iSortOrder = 4
  8.  
  9. scenario.vShowMessageBoxes[STDDT_AUTOFINISH_COMBAT] = false
  10. scenario.vShowMessageBoxes[STDDT_COMBAT_PHASE] = false
  11. scenario.vShowMessageBoxes[STDDT_YOU_CAPTURED_CAPITAL] = false
  12. scenario.vShowMessageBoxes[STDDT_YOU_CLEARED_TERRITORY] = false
  13. scenario.vShowMessageBoxes[STDDT_ENEMY_CLEARED_TERRITORY] = false
  14. scenario.vShowMessageBoxes[STDDT_YOU_CAPTURED_COUNTRY] = false
  15. scenario.vShowMessageBoxes[STDDT_ENEMY_CAPTURED_COUNTRY] = false
  16.  
  17. Player(PT_PLAYER, RACE_HUMANS)
  18. Player(PT_AI, RACE_ALIENS)
  19.  
  20. SetInitialCamera(-0.601535, 0.000000, 0.798847, 0.000000, -0.652736, 0.576498, -0.491513, 0.000000,-0.460534, -0.817098, -0.346784, 0.000000,621.513794, 531.616394, -113.558456, 1.000000)
  21.  
  22. function InitialMOB()
  23.     StartMOB(1)
  24.  
  25.     MoveUnit(1, 5, 7)
  26.     MoveUnit(2, 5, 5)
  27.     MoveUnit(3, 6, 10)
  28.     MoveUnit(4, 5, 11)
  29.     MoveUnit(5, 5, 9)
  30.  
  31.     FlyCamera(-0.162952, 0.000000, 0.986634, 0.000000, -0.910255, 0.385791, -0.150338, 0.000000,-0.380635, -0.922586, -0.062865, 0.000000,512.935364, 336.092926, -301.628510, 1.000000)
  32.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_02")
  33.  
  34.     MoveUnit(4101, 12, 8)
  35.  
  36.     FlyCamera(-0.078375, 0.000000, 0.996924, 0.000000, -0.729729, 0.681326, -0.057369, 0.000000,-0.679229, -0.731980, -0.053399, 0.000000,923.968628, 228.287949, -317.938477, 1.000000)
  37.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_03")
  38.  
  39.     FlyCamera(-0.996785, 0.000000, -0.080127, 0.000000, 0.055249, 0.724262, -0.687308, 0.000000,0.058033, -0.689525, -0.721933, 0.000000,755.021790, 268.665344, -143.030701, 1.000000)
  40.     Fly(4098, 13028)
  41.     Fly(4099, 13028)
  42.     Fly(4100, 13028)
  43.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_04")
  44.  
  45.     FlyCamera(-0.695875, 0.000000, 0.718163, 0.000000, -0.661381, 0.389718, -0.640855, 0.000000,-0.279881, -0.920934, -0.271195, 0.000000,745.664246, 161.601517, -213.458069, 1.000000)
  46.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_05")
  47.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_06")
  48.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_07")
  49.  
  50.     FlyCamera(-0.524184, -0.000000, 0.851605, 0.000000, -0.809007, 0.312313, -0.497963, 0.000000,-0.265968, -0.949979, -0.163710, 0.000000,640.328552, 336.375793, -299.658508, 1.000000)
  51.     ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_08")
  52.  
  53.     SetCameraSpeed(0.4)
  54.     FlyCamera(-0.085583, 0.000000, 0.996331, 0.000000, -0.567308, 0.822063, -0.048731, 0.000000,-0.819046, -0.569397, -0.070355, 0.000000,519.362488, 102.136452, -285.686218, 1.000000)
  55.     ShowXBallon(51, -1, MBS_CENTER, 300, 315, "sc_Train_06_09")
  56.     SetCameraSpeed(1)
  57.  
  58.     FlyCamera(0.705589, 0.000000, 0.708622, 0.000000, -0.629390, 0.459479, 0.626696, 0.000000,-0.325597, -0.888189, 0.324203, 0.000000,771.880005, 390.186371, -492.092743, 1.000000)
  59.  
  60.     FinishMOB()
  61. end
  62.  
  63. function OnEndAITurn()
  64.     if GetHP(2) == 4 then
  65.         StartMOB(1)
  66.         FlyCamera(0.310873, -0.000000, 0.950451, 0.000000, -0.781777, 0.568719, 0.255703, 0.000000,-0.540540, -0.822532, 0.176799, 0.000000,616.212463, 131.282776, -194.578766, 1.000000)
  67.         ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_10")
  68.         ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_11")
  69.         FinishMOB()
  70.     end
  71.  
  72.     local pos = GetPos(4101)
  73.     if pos.x == 11 and pos.y == 7 and ( IsAlive(1) or IsAlive(2) or IsAlive(3) ) then
  74.         StartMOB(1)
  75.         SetMP(4101, 0)
  76.         FinishMOB()
  77.     end
  78. end
  79.  
  80. function OnHexClicked(x, y, clicked_unit, selected_unit, command)
  81.     if selected_unit == 4101 and command == CMD_MOVE and IsAlive(2) then
  82.         if x ~= 11 or y ~= 7 then
  83.             IncorrectAction("sc_Train_06_27")
  84.         end
  85.     end
  86.  
  87.     if command == CMD_SELECT and GetType( clicked_unit ) == AIR and HasFired( clicked_unit ) then
  88.         StartMOB(1)
  89.         ShowXBallon(51, -1, MBS_CENTER, 300, 300, "sc_Train_06_27a")
  90.         FinishMOB()
  91.     end
  92.  
  93.     local target
  94.  
  95.     if ( IsAlive( 1 ) ) then
  96.         target = 1
  97.     elseif ( IsAlive( 2 ) ) then
  98.         target = 2
  99.     elseif ( IsAlive( 3 ) ) then
  100.         target = 3
  101.     elseif ( IsAlive( 4 ) ) then
  102.         target = 4
  103.     elseif ( IsAlive( 5 ) ) then
  104.         target = 5
  105.     end
  106.  
  107.     if command == CMD_FIRE or command == CMD_BOMB then
  108.         if ( clicked_unit ~= target ) then
  109.             IncorrectAction("sc_Train_06_28")
  110.         end
  111.     end
  112. end
  113.  
  114. old_prompt = ""
  115.  
  116. local bCanEndPhase = false
  117.  
  118. function OnUpdate()
  119.     bCanEndPhase = false
  120.  
  121.     if IsAlive( 4101 ) then
  122.         if not HasFired( 4101 ) then
  123.             if CanAttackThisTurn( 4101, 2 ) and IsAlive( 2 ) and GetHP( 2 ) <= 2 then
  124.                 ShowPrompting("sc_Train_06_12")
  125.                 return
  126.             end
  127.             
  128.             if CanAttackThisTurn( 4101, 4 ) and IsAlive( 4 ) and GetHP( 4 ) <= 2 then
  129.                 ShowPrompting("sc_Train_06_13")
  130.                 return
  131.             end
  132.  
  133.             if CanAttackThisTurn( 4101, 5 ) and IsAlive( 5 ) and GetHP( 5 ) <= 2 then
  134.                 ShowPrompting("sc_Train_06_14")
  135.                 return
  136.             end
  137.         end
  138.     end
  139.  
  140.     local nFired = 0
  141.     for id = 4098, 4100 do
  142.         if HasFired( id ) then
  143.             nFired = nFired + 1
  144.         end
  145.     end
  146.  
  147.     if nFired < 3 then
  148.         if GetType( GetSelectedUnit() ) ~= AIR or HasFired( GetSelectedUnit() ) then
  149.             if not IsDesantInfoDisplaying() then
  150.                 ShowPrompting("sc_Train_06_15")
  151.             elseif nFired == 0 then
  152.                 ShowPrompting("sc_Train_06_16")
  153.             elseif nFired == 1 then
  154.                 ShowPrompting("sc_Train_06_17")
  155.             elseif nFired == 2 then
  156.                 ShowPrompting("sc_Train_06_18")
  157.             end
  158.  
  159.             return
  160.         end
  161.     end
  162.  
  163.     if GetType( GetSelectedUnit() ) == AIR and not HasFired( GetSelectedUnit() ) then
  164.         if IsAlive( 1 ) then
  165.             ShowPrompting("sc_Train_06_19")
  166.         elseif IsAlive( 2 ) then
  167.             ShowPrompting("sc_Train_06_20")
  168.         elseif IsAlive( 3 ) then
  169.             ShowPrompting("sc_Train_06_21")
  170.         elseif IsAlive( 4 ) then
  171.             ShowPrompting("sc_Train_06_22")
  172.         else
  173.             ShowPrompting("sc_Train_06_23")
  174.         end
  175.  
  176.         return
  177.     end
  178.  
  179.     if IsAlive( 4101 ) then
  180.         local bCapitalDanger = false
  181.  
  182.         for enemy = 1, 5 do
  183.             if GetUnitTurnsTo( enemy, 11, 7, true ) <= 1 then
  184.                 bCapitalDanger = true
  185.                 break
  186.             end
  187.         end
  188.  
  189.         if bCapitalDanger then
  190.             ShowPrompting("sc_Train_06_24")
  191.             return
  192.         end
  193.     end
  194.  
  195.     if not HasPrompting() then
  196.         ShowPrompting("sc_Train_finish_phase")
  197.         bCanEndPhase = true
  198.     end
  199. end
  200.  
  201. function OnUnitDead(unit)
  202.     if GetAliveUnitsAmount(COLOR_RED) == 0 then
  203.         StartMOB(1)
  204.         ShowXBallon(4, -1, MBS_CENTER, 599, 381, "sc_Train_06_25")
  205.         ShowXBallon(4, -1, MBS_CENTER, 599, 381, "sc_Train_06_26")
  206.         ShowXBallon(4, -1, MBS_CENTER, 599, 381, "sc_Train_06_26a")
  207.         ShowXBallon(4, -1, MBS_CENTER, 599, 381, "sc_Train_06_26b")
  208.         FinishMOB()
  209.     end
  210. end
  211.  
  212. function OnEndPhase( phase )
  213.     if phase == PHASE_COMBAT then
  214.         if not bCanEndPhase then
  215.             IncorrectAction("sc_Train_01_05")
  216.         end
  217.     end
  218. end
  219.  
  220. function CheckForVictory()
  221.     if(GetAliveUnitsAmount(COLOR_RED) == 0) then 
  222.         return GAMERESULT_VICTORY 
  223.     end
  224.  
  225.     if(IsDead(4098)) then 
  226.         return GAMERESULT_DEFEAT 
  227.     end
  228.  
  229.     return GAMERESULT_NONE
  230. end
  231.  
  232. function aiUnit(unit)
  233.     aiMustNot()
  234.     aiSetFear(0)
  235.     aiHexAttraction(11, 7, 3)
  236. end
  237.  
  238. function InitialSetup()
  239.     Country(5, ALLIANCE_FNU_ALLY)
  240.     Money(5, MONEY_TOTAL_REVENUE, 0)
  241.  
  242.     Country(14, ALLIANCE_NEUTRAL_FNU)
  243.     Money(14, MONEY_GUERRILLA, 0)
  244.     Money(14, MONEY_TOTAL_REVENUE, 0)
  245.  
  246.     Country(13, ALLIANCE_FL_ALLY)
  247.     Money(13, MONEY_TOTAL_REVENUE, 0)
  248.  
  249.     SetupUnit(4098, AIR, 17, 21, 0)
  250.     SetupUnit(4099, AIR, 17, 21, 1)
  251.     SetupUnit(4100, AIR, 17, 21, 2)
  252.     SetupUnit(4101, TANK, 10, 10)
  253.     SetMP(4101, 0)
  254.  
  255.     SetupUnit(1, ARTILLERYA, 4, 8)
  256.     SetupUnit(2, AMPHIBIAA, 2, 8)
  257.     SetupUnit(3, TANKA, 5, 11)
  258.     SetupUnit(4, TANKA, 4, 12)
  259.     SetupUnit(5, LBOTA, 4, 10)
  260. end
  261.